home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / DbaseIII+ {Windows} / DISK6 / SAMPLES2.PAK / EQUIPMNT.WFM < prev    next >
Encoding:
Text File  |  1994-08-02  |  6.6 KB  |  215 lines

  1. ******************************************************************************
  2. *  PROGRAM:      Equipmnt.wfm
  3. *
  4. *  WRITTEN BY:   Borland Samples Group
  5. *
  6. *  DATE:         5/93
  7. *
  8. *  UPDATED:      6/94
  9. *
  10. *  REVISION:     $Revision:   1.49  $
  11. *
  12. *  VERSION:      dBASE FOR WINDOWS 5.0
  13. *
  14. *  DESCRIPTION:  This program allows changing equipment for the AirBorland
  15. *                airlines -- it uses a main display form (defined here), and
  16. *                other dialog forms (changeq.wfm, getflts.wfm) for obtaining
  17. *                information for its display.
  18. *
  19. *  PARAMETERS:   None
  20. *
  21. *  CALLS:        Equipmnt.mnu   (Menu for this form)
  22. *                Changeq.wfm    (Form for changing equipment)
  23. *                Equipmnt.qbe   (View of tables)
  24. *
  25. *  USAGE:        DO Equipmnt.wfm
  26. *
  27. *******************************************************************************
  28. create session
  29. set talk off
  30. set ldCheck off
  31.  
  32.  
  33. ** END HEADER -- do not remove this line*
  34. * Generated on 06/01/94
  35. *
  36. LOCAL f
  37. f = NEW EQUIPMNTFORM()
  38. f.Open()
  39.  
  40. CLASS EQUIPMNTFORM OF FORM
  41.    this.ColorNormal = "N/0XFFFF80"
  42.    this.MousePointer =          1
  43.    this.MDI = .F.
  44.    this.Width =         99.52
  45.    this.Top =          0.00
  46.    this.Left =          2.97
  47.    this.Text = "Flight Equipment Management"
  48.    this.Maximize = .F.
  49.    this.Minimize = .F.
  50.    this.View = "EQUIPMNT.QBE"
  51.    this.MenuFile = "EQUIPMNT.MNU"
  52.    this.Height =         26.42
  53.    this.HelpFile = ""
  54.    this.HelpId = ""
  55.    this.OnOpen = CLASS::ONOPEN
  56.    this.OnClose = CLASS::ONCLOSE
  57.  
  58.    DEFINE IMAGE LOGOIMAGE OF THIS;
  59.        PROPERTY;
  60.          Width         99.60,;
  61.          Top          0.00,;
  62.          Left          0.66,;
  63.          Alignment          2,;
  64.          DataSource "FILE AIRBRLND.BMP",;
  65.          Height          6.88
  66.  
  67.    DEFINE TEXT TITLE OF THIS;
  68.        PROPERTY;
  69.          ColorNormal "B/0XFFFF80",;
  70.          Width         99.02,;
  71.          Top          7.16,;
  72.          Left          0.00,;
  73.          Text "Flight Information",;
  74.          Alignment          1,;
  75.          Border .F.,;
  76.          FontSize         14.00,;
  77.          Height          2.20
  78.  
  79.    DEFINE BROWSE FLIGHTSBROWSE OF THIS;
  80.        PROPERTY;
  81.          Fields "FLIGHTS->FLIGHT_NO\H='FLIGHT NO'\12,FLIGHTS->ORIGIN\8,FLIGHTS->DEST\H='DESTINATION'\14,FLIGHTS->PRICE\12,FLIGHTS->DATE\12,FLIGHTS->DEPARTURE\12,FLIGHTS->ARRIVAL\16",;
  82.          ColorNormal "N/W",;
  83.          Width        93.62,;
  84.          ShowRecNo .F.,;
  85.          Top          8.80,;
  86.          Alias "Flights",;
  87.          Left          3.15,;
  88.          FontBold .F.,;
  89.          Modify .F.,;
  90.          Height          7.13
  91.  
  92.    DEFINE PUSHBUTTON EQUIPBUTTON OF THIS;
  93.        PROPERTY;
  94.          ColorNormal "B/W",;
  95.          Width         32.99,;
  96.          Top         17.61,;
  97.          OnClick CLASS::CHANGEEQUIPMNT ,;
  98.          Left         63.35,;
  99.          Text "Change Equipment",;
  100.          FontSize         12.00,;
  101.          Default .T.,;
  102.          Height          3.30
  103.  
  104.    DEFINE ENTRYFIELD PLANEENTRY OF THIS;
  105.        PROPERTY;
  106.          ColorNormal "B/0XFFFF80",;
  107.          Width         19.80,;
  108.          Top         16.29,;
  109.          Left          6.60,;
  110.          Enabled .F.,;
  111.          Border .F.,;
  112.          FontSize         12.00,;
  113.          DataLink "AIRCRDB->AIRCRAFT",;
  114.          Height          1.17
  115.  
  116.    DEFINE IMAGE PLANEIMAGE OF THIS;
  117.        PROPERTY;
  118.          Width         46.19,;
  119.          Top         17.61,;
  120.          Left          6.60,;
  121.          DataSource "BINARY AIRCRDB->IMAGE",;
  122.          Height          7.37
  123.  
  124.    *******************************************************************************
  125.    procedure OnOpen
  126.    *******************************************************************************
  127.    private fld
  128.  
  129.    set exact off
  130.    set fields to
  131.    set fields off
  132.    shell(.f.)
  133.  
  134.    *** Create arrays for use in GetFlts.wfm in order to bring it up faster
  135.  
  136.    public originAr, destAr
  137.    local curRecCnt
  138.    private fld, tagName
  139.  
  140.    *** Make array of unique origins
  141.    use flights in select() alias temp
  142.    select temp
  143.    tagName = field(2) + "UN"
  144.    set order to &tagName                   && Origin unique tag
  145.    count to curRecCnt                      && For declaring array
  146.    declare originAr[curRecCnt,1]
  147.    fld = field(2)                          && Origin field
  148.    copy to array originAr field &fld
  149.  
  150.    *** Make array of unique destinations
  151.    tagName = field(3) + "UN"
  152.    set order to &tagName                   && Destination unique tag
  153.    count to curRecCnt                      && For declaring array
  154.    declare destAr[curRecCnt,1]
  155.    fld = field(3)                          && Dest field
  156.    copy to array destAr field &fld
  157.    use
  158.  
  159.    select flights                          && Return to original workarea
  160.  
  161.  
  162.    *******************************************************************************
  163.    procedure OnClose
  164.    *******************************************************************************
  165.    release originAr, destAr
  166.    shell(.t.)
  167.  
  168.  
  169.    *******************************************************************************
  170.    procedure ChangeEquipmnt
  171.    *******************************************************************************
  172.    local curAircraft, newAircraft
  173.    curAircraft = flights->aircraft        && Save current aircraft
  174.    newAircraft = CLASS::CallChangeEqForm(curAircraft)
  175.    if curAircraft <> newAircraft          && Only change table with new aircraft
  176.       replace flights->aircraft with newAircraft
  177.       refresh
  178.    endif
  179.  
  180.    *******************************************************************************
  181.    function CallChangeEqForm(curAircraft)
  182.  
  183.    * Open modally form ChangeEq, which allows changing the plane currently used.
  184.    * ChangeEq.wfm has a listbox of plane names, and an image of the name currently
  185.    * highlighted in the listbox.  The image is defined on a binary field of
  186.    * Aircrdb.dbf, and the listbox is defined on its name field, so the image
  187.    * changes as you move through the listbox.
  188.    *******************************************************************************
  189.    local changeEqForm, childRec, retVal
  190.  
  191.    childRec = recno("aircrdb")            && This is for highlighting current
  192.    set procedure to Changeq.wfm additive  && plane in the Changeq form's listbox
  193.    create session
  194.    changEqForm = new ChangEqForm()
  195.    changEqForm.mdi = .F.
  196.    changEqForm.value = curAircraft
  197.    changEqForm.childRec = childRec
  198.    changEqForm.Readmodal()
  199.    retVal = changEqForm.value
  200.    changEqForm.Release()
  201.    return retVal                          && Return the new airplane
  202.  
  203.  
  204. ENDCLASS
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.